/**
 * 选择课程回调
 * @param result 回调数据
 */
var userId =0;
function selectCourseCallback(result) {
    if(result!=null && result.length>0){
        var courseIds = $('input[name="courseIds"]').val();
        if(courseIds==null||courseIds==''){
            courseIds =',';
        }
        $.each(result,function (index,course) {
            if(courseIds.indexOf(","+course.id+",")==-1){
                courseIds +=course.id+',';
            }
        });
        $.ajax({
            url:baseloaction+"/admin/order/user/giveUserCourse",
            data:{
                "courseIds":courseIds,
                "userId":userId
            },
            dataType:"json",
            type:"post",
            beforeSend:function (xhr) {
                icModale(0,"数据生成中，请稍后...");
            },
            success:function (result) {
                icModale(0,result.message);
                if(result.success==true){
                    parent.layer.closeAll();
                    userId=0;
                }
            }
        });
    }
}